// 个人信息
import { defineStore } from 'pinia'
import { reactive } from 'vue'

export const useUserStore = defineStore('user', () => {
    const userInfo = reactive({
        name: 'admin',
        avatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
    })

    const setUserInfo = (data: any) => {

        Object.assign(userInfo, data)
    }

    const removeUserInfo = () => {
        Object.assign(userInfo, {
            name: '',
            avatar: ''
        })
    }

    return {
        userInfo,
        setUserInfo,
        removeUserInfo
    }
})